package com.yabiao.idempotent.controller;

import com.yabiao.idempotent.annotation.AutoIdempotent;
import com.yabiao.idempotent.token.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *
 * </p>
 *
 * @author: zhangyb
 * @create: 2020-09-13
 **/
@RestController
public class HelloController {
    @Autowired
    private TokenService tokenService;

    @GetMapping("getToken")
    public String getToken(){
        return tokenService.createToken();
    }

    @PostMapping("getData")
    @AutoIdempotent
    public String addAnnotation(){
        return "ok";
    }

    @GetMapping("hello")
    public String hello(){
        return "hello";
    }
}
